package com.emily.test.service.impl;

import com.emily.test.mapper.ONavigationMapper;
import com.emily.test.model.ONavigation;
import com.emily.test.service.NavigationService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.sql.Date;
/**
 * @author ：zc
 * @date ：Created in 2019/3/26 18:06
 * @description：
 */
@Service
@Transactional(rollbackFor = {Exception.class})
public class NavigationServiceImpl implements NavigationService {
    @Resource
    private ONavigationMapper oNavigationMapper;
    @Override
    public List<ONavigation> getNavigationList() {
        return oNavigationMapper.getNavigationAllList();
    }

    @Override
    public ONavigation getNavigation(Integer id) throws Exception {
        return oNavigationMapper.getNavigation(id);
    }

    @Override
    public void delete(Integer id) throws Exception {
        oNavigationMapper.delNavigationList(id);
    }

    @Override
    public int insert(ONavigation o) {
        o.setUpdateTime(new Date(System.currentTimeMillis()).toString());
        return oNavigationMapper.insertSelective(o);
    }

    @Override
    public void update(ONavigation o) {
        o.setUpdateTime(new Date(System.currentTimeMillis()).toString());
       oNavigationMapper.update(o);
    }
}
